#import <UIKit/UIKit.h>

typedef void(^ViewHandler)(id view, BOOL *stop);

/*===================================================================
 标准视图扩展
 ==================================================================*/
@interface UIView (Extension)

@property (nonatomic) BOOL	passthrough;
@property (readonly) UIViewController	*viewController;	//视图所在控制器

@property (nonatomic, copy) IBInspectable NSString	*language;
- (void)didLanguage;

//获取指定View, 将包含self
- (void)viewWithTag:(NSInteger)tag handler:(ViewHandler)handler;
- (void)viewWithClass:(Class)class handler:(ViewHandler)handler;

//
- (void)setCircleWithWidth:(CGFloat)width color:(UIColor *)color;
- (void)setBorderWithWidth:(CGFloat)width radius:(CGFloat)radius color:(UIColor *)color;

- (UIView *)setSkinBlurEffect;
- (UIView *)setSkinBlurEffectWithEdge:(UIRectEdge)edge;
- (UIView *)setBlurEffectWithStyle:(UIBlurEffectStyle)style withEdge:(UIRectEdge)edge;

- (void)setShadowWithRadius:(CGFloat)radius color:(UIColor *)color;
- (void)setShadowWithRadius:(CGFloat)radius color:(UIColor *)color path:(UIBezierPath *)path;

//
- (NSLayoutConstraint *)addConstraintWithWidth:(CGFloat)width;		//添加宽度约束(0.0~1.0为父视图宽度的百分比)
- (NSLayoutConstraint *)addConstraintWithHeight:(CGFloat)height;	//添加高度约束(0.0~1.0为父视图高度的百分比)

- (NSArray *)addConstraintEqualSuperview:(UIView *)superview;       //将视图添加到指定父视图同时添加等同于父视图的约束
- (NSArray *)addConstraintEqualSuperview:(UIView *)superview withTop:(CGFloat)top withBottom:(CGFloat)bottom;

- (NSArray *)getConstraintFromSuperview;	//从父视图约束中获取与自己相关的约束

- (void)disableConstraint;					//禁用约束
- (void)removeConstraintFromSuperview;		//从父视图移除与自己有关的约束

//
+ (void)drawGradientWithRect:(CGRect)rect colors:(id)colors orientation:(UIInterfaceOrientation)orientation;
+ (void)drawLinearGradient:(CGContextRef)ctx colors:(id)colors startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
+ (void)drawRadialGradient:(CGContextRef)ctx rect:(CGRect)rect colors:(id)colors start:(CGFloat)start end:(CGFloat)end;

+ (instancetype)viewWithColor:(UIColor *)color;

@end
